﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using HelloMinasan.Web.Song.ViewModels;
using HelloMinasan.Business;

namespace HelloMinasan.Web.Song.Controllers
{
    public class MailBoxController : Controller
    {
        ////private readonly IRepository._InternalMessageIRepository _IRepository;
        ////public MailBoxController()
        ////    : this(new InternalMessageRepository())
        ////{
        ////}

        ////private MailBoxController(IRepository._InternalMessageIRepository irepository)
        ////{
        ////    this._IRepository = irepository;
        ////}

        //private ISongService songService;
        //private IUserService userService;

        //public MailBoxController(ISongService songService, IUserService userService)
        //{
        //    this.songService = songService;
        //    this.userService = userService;
        //}

        //[Authorize]
        //public ActionResult UnreadMail()
        //{
        //    return View(_IRepository.GetUnreadMails(User.Identity.Name));
        //}
        //[Authorize]
        //public ActionResult ReadMail()
        //{
        //    return View(_IRepository.GetReadMails(User.Identity.Name));
        //}
        //[Authorize]
        //[HttpGet]
        //public ActionResult ComposeMail(string id)
        //{

        //    return View(new MailModel() { Reciever = id });
        //}
        //[Authorize]
        //[HttpPost]
        //public ActionResult ComposeMail(MailModel model)
        //{
        //    try
        //    {
        //        var sender = new UserIRepository().FindUserById(User.Identity.Name).UserId;
        //        var reciever = new UserIRepository().FindUserById(model.Reciever).UserId;
        //        _IRepository.SendMail(new InternalMessage()
        //        {
        //            MailStatus = false,
        //            MessageContent = model.MailContent,
        //            MessageTitle = model.MailTitle,
        //            Owners = sender,
        //            Reciever = reciever,
        //            PostedDate = DateTime.Now
        //        });
        //        ViewBag.Message = "Mail has sent.";
        //    }
        //    catch (Exception ex)
        //    {
        //        ViewBag.Message = "Action failed.";
        //    }
        //    return View(model);
        //}
        //[Authorize]
        //[HttpGet]
        //public ActionResult ViewMessage(int id)
        //{
        //    return View(new InternalMessageRepository().GetMailContent(id));
        //}
    }
}
